package collectiondemo;

public class Student implements Comparable<Student> {
    //属性
    private String stuName;
    private  String stuNum;
    private  double stuScore;

    //行为
    public Student(){ }
    public Student(String stuName,String stuNum,double stuScore){
        this.stuName = stuName;
        this.stuNum = stuNum;
        this.stuScore = stuScore;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public double getStuScore() {
        return stuScore;
    }

    public void setStuScore(double stuScore) {
        this.stuScore = stuScore;
    }

    public  String toString(){
        return "Student{"+"stuName="+stuName+",stuNum="+stuNum+",stuScore="+stuScore+"}";
    }

    public int compareTo(Student stu) {
        //比较业务逻辑i的实现
        //默认值，默认是等于
        int i = 0;
        if (stu != null) {
            if (this.getStuScore() > stu.getStuScore()) {
                //大于
                i = 1;
            }
        }
       // return i;
        return i*-1;
    }
}
